package utilities.event;

import java.util.Date;

import org.hibernate.Session;
import org.zkoss.zul.Combobox;

import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;

import utilities.Updatable;

import utilities.utilities_components.Duration;

public class RTCListener implements EventListener{
	private Duration duration;
	private Combobox type;
	private Updatable updateItem;
	
	public RTCListener( Duration duration, Combobox type, Updatable updateItem ){
		this.duration = duration;
		this.type = type;
		this.updateItem = updateItem;
	}
	
	public void onEvent( Event event ){
		Date begin = duration.getBegin();
		if( begin != null ){
			Date end = duration.getEnd();
			
			updateItem.update( getData( begin, end, type.getSelectedIndex() ), session );
		}
	}
	
	//只有两个子List第一个子List的第一项为字符串"计天房",第二项为满足条件的计天房信息
	//第二个子List的第一项为字符串"钟点房",第二项为满足条件的钟点房信息
	//条件:起始日期begin截止日期end间的房屋租用情况,type为请求的统计信息1-按订房次数统计,2-按订房天数统计,3-按房费收入统计
	private List getData( Date begin, Date end, int type, Session session ){
		
	}
}
